<?php
/**
 * Created by PhpStorm.
 * User: Jerry
 * Date: 2017/3/15
 * Time: 12:03
 */

namespace SDXApi\Model;


use Think\Model;

/**
 * Class AlbumTemplateModel
 * @package SDXApi\Model
 */
class AlbumTemplateModel extends Model
{
	/**
	 * @var string
	 */
	protected $tableName = 'album_template';


	/**
	 * Created by Jerry
	 * @param int $albumId
	 * @return mixed
	 */
	public function findAlbumTemplateByAlbumId($albumId = 0)
	{
		$where = array(
			'album_id'	=>	$albumId,
		);

		return $this->where($where)->select();
	}

	/**
	 * Created by Jerry
	 * @param int $albumId
	 * @return bool|mixed
	 */
	public function findAlbumTemplateGoodsIdByAlbumId($albumId = 0)
	{
		if (empty($albumId)) {
			return false;
		}

		$where = array(
			'album_id'	=>	$albumId,
		);

		return $this->table('sdx_album_template_goods')->where($where)->getField('id');
	}
}